package UVA;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;

/*
 * @Author Josh Lear
 * @Date 4-15-2014
 * @Problem simple IO
 */
public class UVA_12289 {
    public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
                System.out));
        int cases = sc.nextInt();
        for (int i = 0; i < cases; i++) {
            int n = 0;
            String cur = sc.next();
            if (cur.length() == 5) {
                n = 3;
            } else if (isOne(cur)) {
                n = 1;
            } else {
                n = 2;
            }
            bw.write(n + "\n");
        }
        bw.flush();
        sc.close();
    }

    public static boolean isOne (String cur) {
        boolean l = false;
        if (cur.charAt(0) == 'o'
                && ((cur.charAt(2) == 'e' || cur.charAt(1) == 'n'))) {
            l = true;
        }
        if (cur.charAt(1) == 'n'
                && ((cur.charAt(2) == 'e') || (cur.charAt(0) == 'o'))) {
            l = true;
        }
        if (cur.charAt(2) == 'e'
                && ((cur.charAt(1) == 'n') || (cur.charAt(0) == 'o'))) {
            l = true;
        }
        return l;
    }
}
